package com.yyt.springbootjwt.controller;

import com.yyt.springbootjwt.annotation.UserLoginToken;
import com.yyt.springbootjwt.domain.User;
import com.yyt.springbootjwt.service.UserService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author yeyangtao
 * @date 2020/5/22 14:32
 */
@RestController
@RequestMapping("user")
public class UserController {
    @Resource
    private UserService userService;

    @PostMapping("login")
    public Object login(@RequestBody User user) {
        //忽略登陆逻辑
        return userService.getToken(user);
    }

    @UserLoginToken
    @GetMapping("/getMessage")
    public String getMessage() {
        return "你已通过验证";
    }
}
